<script type="text/javascript">
	function runBtn(value, row, index) {
		if (value == '1') {
			return '<span class="icon icon-running" title="停止" onclick="change('
					+ row.id + ', \'stop\')"></span>';
		} else {
			return '<span class="icon icon-start" title="启动" onclick="change('
					+ row.id + ', \'start\')"></span>';
		}
	}

	function change(id, state) {
		$.ajax({
			url : 'app/task/' + id + '/' + state,
			type : 'POST',
			success : function(date) {
				$('#task-table').datagrid('reload');
			}
		});
	}
</script>
<div id="task-tb" style="padding: 5px; height: auto">
	<div style="margin-bottom: 5px">
	<input id="task-search" type="text"></input> <a href="#"
			class="easyui-linkbutton" onclick="onQuery('task')">查询</a> 
		<a href="#" class="easyui-linkbutton" iconCls="icon-add"
			onclick="onAdd('task')">新增</a>
	</div>
</div>
<table id="task-table" class="easyui-datagrid"
	data-options="rownumbers:true,singleSelect:true,fitColumns:true,pagination:true,pageSize:10,toolbar:'#task-tb',loadFilter:pagerFilter,url:'app/task'">
	<thead>
		<tr>
			<th data-options="field:'name',width:50">任务名称</th>
<!-- 			<th data-options="field:'cron',width:50">执行计划</th>
			<th data-options="field:'content',width:50">命令</th> -->
			<th data-options="field:'number',width:50">计划执行次数</th>
			<th data-options="field:'numberNow',width:50">已执行次数</th>
			<th
				data-options="field:'flag',formatter:runBtn,width:50,align:'center'">启运</th>
			<th
				data-options="field:'id',formatter:taskBtn,width:50,align:'center'">操作</th>
		</tr>
	</thead>
</table>

